<?php

namespace Library\Action;

abstract class PortalAction extends \Library\Action {

	private $_view;
	private $_title;
	private $_icon = 'images/openluke.png';
	
	public function execute() {
		parent::execute();
		$this->_view = strtr( get_class( $this ), '\\', '/' );
	}

	public function setView( $view ) {
		$this->_view = $view;
		return $this;
	}
	
	public function getView() {
		return $this->_view;
	}
	
	public function view( $global = true ) {
		if( $global === true ) {
			ob_start();
			require 'View/Action/Master.html';
			return ob_get_clean();
		}
		else {
			return parent::view();
		}
	}
	
	public function setTitle( $title ) {
		$this->_title = $title;
		return $this;
	}
	
	public function getTitle() {
		return $this->_title;
	}
	
	public function setIcon( $icon ) {
		$this->_icon = $icon;
		return $this;
	}
	
	public function getIcon() {
		return $this->_icon;
	}
	
	public function getContent() {
		ob_start();
		require 'View/' . $this->_view . '.html';
		return ob_get_clean();
	}
}
